<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <div id="app">
        <input type="text" v-model="msg">
    </div>
</body>
<script src="../js/vue.js"></script>
<script>
    Vue.config.productionTip = false;
    new Vue({
        data:{msg:"message from data"},
        mounted(){
            //监听msg
            this.$watch("msg",{
                handler(newVal){
                    console.log("watch:msg",newVal)
                },
                immediate:true
            })
        }
    }).$mount("#app")
</script>
</html>